home *** CD-ROM | disk | FTP | other *** search
/ Whiteline: Alpha / Whiteline Alpha.iso / dl_serie / 059 / tmon202 / tmonmodt.s < prev   
Encoding:
Text File  |  1994-09-25  |  10.7 KB  |  202 lines

  1. ; *************************************************************************
  2. ; *                                                                       *
  3. ; *                     T M O N M O D T . E X E                           *
  4. ; *                                                                       *
  5. ; *                     © 1992 by Johannes Hill                           *
  6. ; *                                                                       *
  7. ; * This program adds a new address translation table to TempleMon. The   *
  8. ; * address translation structur is linear and flat. This table does not  *
  9. ; * limit access of TempleMon to any address space!                       *
  10. ; *                                                                       *
  11. ; *************************************************************************
  12. ; *                                                                       *
  13. ; * This program requires memory protection state GLOBAL! Set also the    *
  14. ; * program flags FASTLOAD, LOAD INTO TT RAM and ALTERNATE MALLOC!        *
  15. ; *                                                                       *
  16. ; *************************************************************************
  17. ; This is a specific optimized PMMU table for TempleMon only!
  18. ;   DO NOT USE for TOS! 
  19. ;   No guarantee for correct behavior!
  20. ;   Only for 68030 CPU's! 
  21. ;   DO NOT USE with other PMMU programming programms!
  22. ;   If a 'PMMU` cookie jar entry is found this will program abort 
  23. ;     (for VRAM and OUTSIDE)!
  24. ; This table does only use three stages of address translation! All page 
  25. ; descriptors are early termination desriptors!
  26.  
  27. anfang:         bra     start
  28.  
  29. ; These leading words are necessary to move the table to a quad word beginning
  30. ; address! DO NOT remove them!
  31.  
  32.                 dc.l    0
  33.                 dc.l    0
  34.                 dc.l    0
  35.                 dc.l    0
  36. table_main:     dc.l    $00000002    ; short format table descriptor
  37.                                      ; will point to label table_00_B
  38.                 dc.l    $10000001    ; short format early termination
  39.                 dc.l    $20000001    ; short format early termination
  40.                 dc.l    $30000001    ; short format early termination
  41.                 dc.l    $40000001    ; short format early termination
  42.                 dc.l    $50000001    ; short format early termination
  43.                 dc.l    $60000001    ; short format early termination
  44.                 dc.l    $70000001    ; short format early termination
  45.                 dc.l    $80000001    ; short format early termination
  46.                 dc.l    $90000001    ; short format early termination
  47.                 dc.l    $A0000001    ; short format early termination
  48.                 dc.l    $B0000001    ; short format early termination
  49.                 dc.l    $C0000001    ; short format early termination
  50.                 dc.l    $D0000001    ; short format early termination
  51.                 dc.l    $E0000001    ; short format early termination
  52.                 dc.l    $F0000001    ; short format early termination
  53.                                      ; cache inhibit for I/O and VME via
  54.                                      ; register TT0!
  55.  
  56. table_00_B:     dc.l    $00000002    ; short format table descriptor
  57.                                      ; will point to label table_00_C
  58.                 dc.l    $01000001    ; short format early termination
  59.                 dc.l    $02000001    ; short format early termination
  60.                 dc.l    $03000001    ; short format early termination
  61.                 dc.l    $04000001    ; short format early termination
  62.                 dc.l    $05000001    ; short format early termination
  63.                 dc.l    $06000001    ; short format early termination
  64.                 dc.l    $07000001    ; short format early termination
  65.                 dc.l    $08000001    ; short format early termination
  66.                 dc.l    $09000001    ; short format early termination
  67.                 dc.l    $0A000001    ; short format early termination
  68.                 dc.l    $0B000001    ; short format early termination
  69.                 dc.l    $0C000001    ; short format early termination
  70.                 dc.l    $0D000001    ; short format early termination
  71.                 dc.l    $0E000001    ; short format early termination
  72.                 dc.l    $0F000001    ; short format early termination
  73.  
  74. table_00_C:     dc.l    $00000001    ; short format early termination
  75.                 dc.l    $00100001    ; short format early termination
  76.                 dc.l    $00200001    ; short format early termination
  77.                 dc.l    $00300001    ; short format early termination
  78.                 dc.l    $00400001    ; short format early termination
  79.                 dc.l    $00500001    ; short format early termination
  80.                 dc.l    $00600001    ; short format early termination
  81.                 dc.l    $00700001    ; short format early termination
  82.                 dc.l    $00800001    ; short format early termination
  83.                 dc.l    $00900001    ; short format early termination
  84.                 dc.l    $00A00001    ; short format early termination
  85.                 dc.l    $00B00001    ; short format early termination
  86.                 dc.l    $00C00001    ; short format early termination
  87.                 dc.l    $00D00001    ; short format early termination
  88.                 dc.l    $00E00001    ; short format early termination
  89.                 dc.l    $00F00041    ; short format early termination,
  90.                                      ; with cache inhibit
  91.  
  92. table_end:
  93.  
  94. start:          move.l  4(SP),A5
  95.                 move.l  A5,basepage
  96.                 lea     stackhigh,SP
  97.                 move.l  SP,A6
  98.                 suba.l  A5,A6
  99.                 addq.l  #2,A6
  100.                 move.l  A6,-(SP)
  101.                 move.l  A5,-(SP)
  102.                 clr.w   -(SP)
  103.                 move.w  #$4A,-(SP)   ; Mshrink
  104.                 trap    #1
  105.                 lea     $C(SP),SP
  106.                 clr.l   -(SP)        ; switch to supervisor mode
  107.                 move.w  #$20,-(SP)
  108.                 trap    #1
  109.                 addq.l  #6,SP
  110.                 pea     Mess(PC)     ; print program message
  111.                 move.w  #9,-(SP)
  112.                 trap    #1
  113.                 addq.l  #6,SP
  114.                 movea.l $05A0,A3     ; check Cookie Jar
  115.                 movea.l A3,A0
  116.                 tst.l   $05A0        ; abort if cookie jar is absent
  117.                 beq     no_TMon
  118. search_pmmu:    cmpi.l  #'PMMU',(A0) ; check for 'PMMU' cookie
  119.                 beq     PMMU         ; and abort if found
  120.                 addq.l  #8,A0
  121.                 tst.l   (A0)
  122.                 bne     search_pmmu
  123. search:         cmpi.l  #'TMon',(A3) ; check for 'TMon' cookie
  124.                 beq     dotmon       ; start building address transl. table
  125.                 addq.l  #8,A3
  126.                 tst.l   (A3)
  127.                 bne     search
  128. PMMU:           pea     PMMU_Mess(PC) ; abort if 'PMMU' cookie found
  129.                 bra     prg_abort
  130. no_TMon:        pea     no_TMon_Mess(PC) ; abort if TempleMon not found
  131.                 bra     prg_abort
  132. no_68030:       pea     no_68030_Mess(PC) ; abort if no 68030 CPU
  133. prg_abort:      move.w  #9,-(SP)     ; print abort message
  134.                 trap    #1
  135.                 addq.l  #6,SP
  136.                 move.w  #-1,-(SP)
  137.                 move.w  #$4C,-(SP)
  138.                 trap    #1           ; PTERM(-1)
  139.                 bra     no_TMon
  140. dotmon:         move.l  4(A3),A3     ; get TempleMon function handler
  141.                 moveq   #0,D0        ; get TempleMon internal stuff
  142.                 jsr     (A3)         ; call TempleMon
  143.                 andi.b  #$F,D1       ; mask CPU identifier
  144.                 cmpi.b  #3,D1        ; is CPU 68030?
  145.                 bne     no_68030     ; abort if not
  146.                 moveq   #23,D0       ; get/set address translation stuff
  147.                 moveq   #0,D1        ; switch off TempleMon address table
  148.                 move.l  D1,A0        ; no extra routine for TempleMon to be
  149.                                      ; called from TempleMon just before it
  150.                                      ; switches to its own address tree
  151.                 jsr     (A3)         ; call TempleMon
  152.                 move.l  A0,A4        ; save pointer to PMMU register structure
  153.                 lea     table_main(PC),A0  ; compute quad wird address
  154.                 move.l  A0,D0
  155.                 andi.w  #$FFF0,D0
  156.                 move.l  D0,A1
  157.                 move.l  A1,A2
  158.                 lea     table_end(PC),A5
  159. loop:           move.l  (A0)+,(A2)+  ; move table to quad word address
  160.                 cmpa.l  A5,A0
  161.                 bcs     loop
  162.                 move.l  #table_00_B-table_main,D0
  163.                 add.l   A1,D0        ; install pointer to stage B in table
  164.                 or.l    D0,(A1)
  165.                 move.l  #table_00_C-table_main,D0
  166.                 add.l   A1,D0        ; install pointer to stage C in table
  167.                 or.l    D0,table_00_B-table_main(A1)
  168.                 move.l  #$80000002,D0
  169.                 move.l  D0,(A4)           ; set High-long word of CRP
  170.                 move.l  A1,4(A4)          ; set table address of CRP
  171.                 move.l  D0,8(A4)          ; set High-long word of SRP
  172.                 move.l  A1,12(A4)         ; set table address of SRP
  173.                 move.l  #$80F04445,16(A4) ; set TC
  174.                 move.l  #$FE018707,20(A4) ; set TT0
  175.                 clr.l   24(A4)            ; set TT1
  176.                 suba.l  a0,a0             ; no additinal routine for TempleMon
  177.                 moveq   #23,D0            ; get/set address translation stuff
  178.                 moveq   #-1,D1            ; switch on TempleMon address table
  179.                 jsr     (A3)              ; call TempleMon
  180.                 pea     installed(PC)     ; print install message
  181.                 move.w  #9,-(SP)
  182.                 trap    #1
  183.                 addq.l  #6,SP
  184.                 clr.w   -(SP)             ; keep only table resident in memory
  185.                 lea     table_end(PC),A0
  186.                 suba.l  basepage,A0
  187.                 move.l  A0,-(SP)
  188.                 move.w  #$31,-(SP)
  189.                 trap    #1
  190.                 bra     no_TMon
  191. Mess:           dc.b   $1B,'p TMONMODT  V1.0  07/01/92',$1B,'q',13,10
  192.                 dc.b   ' © Johannes Hill',13,10,0
  193. no_TMon_Mess:   dc.b   ' TempleMon not found! ',13,10,7,0
  194. no_68030_Mess:  dc.b   ' Sorry, wrong CPU! ',13,10,7,0
  195. PMMU_Mess:      dc.b   ' Sorry, PMMU programming program found! ',13,10,0
  196. installed:      dc.b   ' New PMMU table for TempleMon installed.',13,10,0
  197.                 BSS
  198. basepage:       ds.l   1
  199. stack:          ds.b   1024
  200. stackhigh:      ds.b   2
  201.                 END
  202.